package com.utils;

import java.nio.charset.StandardCharsets;
import java.util.List;

import com.google.common.collect.Lists;

public class AlphaStr {
	
	//& 0xff 针对utf-8编码
	public static int ord(String s) {
	    return s.length() > 0 ? (s.getBytes(StandardCharsets.UTF_8)[0] & 0xff) : 0;
	}
	
	public static String sub_html(String str, int len) {
		str = str.replaceAll("\r\n", "").replaceAll("\r", "").replaceAll("\n", "");
		if (str.length() > len) {
			return StringUtil.encode(str.substring(0, len)) + "... <span style=\'color:#007aff\'>查看全文</span>";
		} else {
			return StringUtil.encode(str);
		}
		
	}
	
	
	public static int is_all(String str, int len, boolean dot){
		str = str.replaceAll("\r\n", "").replaceAll("\r", "").replaceAll("\n", "");
		if (str.length() > len) {
			return 2;
		}
        return 1;
    }
}
